package com.fulu.game.bi.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 常用的排序规则
 */
@Getter
@AllArgsConstructor
public enum CommonlyOrderEnums {
    NO_ORDER(0, ""),
    UPDATE_DESC(1, " update_time desc "),
    UPDATE_ASC(2, " update_time "),
    CREATE_DESC(3, " create_time desc "),
    CREATE_ASC(4, " create_time asc "),
    ;

    /** 类型 */
    private Integer type;
    /** 值 */
    private String value;

    public static CommonlyOrderEnums getEnum(int type) {
        for (CommonlyOrderEnums ele : CommonlyOrderEnums.values()) {
            if (type == ele.getType()) {
                return ele;
            }
        }
        return UPDATE_DESC;
    }
}
